#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int long long
const int inf = 0x3f3f3f3f;
int a[100005];
void solve()
{
    unordered_map<int, int> mp;
    int n;
    cin >> n;
    int mi = 1e9 + 10, ma = 0;
    for (int i = 0; i < n; i++)
    {
        int size;
        cin >> size;
        for (int j = 0; j < size; j++)
        {
            int x;
            cin >> x;
            mp[x]++;
            a[j] = x;
            mi = min(mi, x);
            ma = max(ma, x);
            if (j >= 1)
            {
                if (a[j] - a[j - 1] <= 0)
                {
                    cout << "NO";
                    return;
                }
            }
        }
    }
    for (int i = mi; i <= ma; i++)
        if (mp[i] != 1)
        {
            cout << "NO";
            return;
        }
    cout << "YES";
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int _ = 1;
    //cin >> _;
    while (_--)
    {
        solve();
    }
    return 0;
}